/**
 * @Version v1.0
 * @Description: TODO
 * @Author ZHANZHONGXIN
 * @Date 2022/5/6 15:17
 * @Copyright 博为峰
 */
public class DoWhileDemo {
    public static void main(String[] args) {
        /*
          do {
            语句;
          } while (条件表达式)
         */

        //计算 1234 各位数字之和 1+2+3+4

        /*
           1234%10   4
           1234/10   123   a

           123%10    3
           1234/10   12    a

           12%10     2
           1234/10   1     a

           1%10      1
           1/10      0     a
         */

        int a = 1234;
        int sum = 0;
        do {
            sum += a % 10;
            a = a / 10;
        } while (a != 0);
        System.out.println(sum);
    }

}
